import request from '@/utils/request'

//获取国家/产品类目/品牌
export function getDatamap(query = {}) {
    return request({
        url: '/datamap',
        method: 'get',
        params: query
    })
}
//删除产品
export function deleteImg(image_id) {
    return request({
        url: `/product/img/${image_id}`,
        method: 'delete',
    })
}

//修改产品推荐值（排序）
export function setProductSort(data) {
    return request({
        url: '/product/opt',
        method: 'put',
        data,
    })
}

//获取产品详情
export function getProductDetail(product_id, query) {
    return request({
        url: `/product/${product_id}`,
        method: 'get',
        params: query
    })
}
//修改产品详情
export function putProductDetail(product_id, data) {
    return request({
        url: `/product/${product_id}`,
        method: 'put',
        data
    })
}

//创建产品
export function addProduct(data) {
    return request({
        url: '/product/addBase',
        method: 'post',
        data
    })
}
//创建产品Faq列表
export function postProductFaqList(product_id, data) {
    return request({
        url: `/qa/${product_id}`,
        method: 'post',
        data
    })
}
//获取产品Faq列表
export function getProductFaqList(product_id) {
    return request({
        url: `/qa/${product_id}`,
        method: 'get',
    })
}
//更新产品Faq列表
export function putProductFaqList(product_id, data) {
    return request({
        url: `/qa/${product_id}`,
        method: 'put',
        data
    })
}
//删除产品Faq列表中单个问题
export function deleteProductFaq(qa_id) {
    return request({
        url: `/qa/${qa_id}`,
        method: 'delete',
    })
}
//创建产品规格列表
export function postProductSpecsList(product_id, data) {
    return request({
        url: `/specs/${product_id}`,
        method: 'post',
        data
    })
}
//获取产品规格列表
export function getProductSpecsList(product_id) {
    return request({
        url: `/specs/${product_id}`,
        method: 'get',
    })
}
//更新产品规格列表
export function putProductSpecsList(product_id, data) {
    return request({
        url: `/specs/${product_id}`,
        method: 'put',
        data
    })
}
//删除产品规格列表中单个问题
export function deleteProductSpecs(specs_id) {
    return request({
        url: `/specs/${specs_id}`,
        method: 'delete',
    })
}
//获取品牌列表
export function getBrandList(query) {
    return request({
        url: '/brand',
        method: 'get',
        params: query
    })
}

//添加品牌
export function addBrand(data) {
    return request({
        url: '/brand',
        method: 'post',
        data,
    })
}

//删除品牌
export function delBrand(id) {
    return request({
        url: `/brand/${id}`,
        method: 'delete'
    })
}

//获取品牌详情
export function getBrandDetail(id) {
    return request({
        url: `/brand/${id}`,
        method: 'get',
    })
}

//编辑品牌详情
export function editBrand(id, data) {
    return request({
        url: `/brand/${id}`,
        method: 'put',
        data,
    })
}

//修改品牌状态
export function switchBrandStatus(id, data) {
    return request({
        url: `/brand/cancel/${id}`,
        method: 'put',
        data,
    })
}

//修改品牌排序
export function setBrandSort(id, data) {
    return request({
        url: `/brand/sort/${id}`,
        method: 'put',
        data,
    })
}












//修改分类排序
export function setCateSort(id, data) {
    return request({
        url: `/category/sort/${id}`,
        method: 'put',
        data,
    })
}